﻿// https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.2.0.txt
// https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT

using System;

namespace yacomp.structs
{
    internal struct struct_zip_item
    {
        public ushort version;
        public ushort flag;
        public ushort compress_type;
        public ushort edit_time;
        public ushort edit_date;
        public uint crc32;
        public uint compress_size;
        public uint not_compress_size;
        public ushort filename_size;
        public ushort ext_size;
        public string filename;
        public byte[] ext;
        public long offset;
        public bool is_utf8() { return (flag & 0xff00) == 0x0800; }
    }

    internal struct struct_zip_central
    {
        public ushort version;
        public ushort decompress_version;
        public ushort flag;
        public ushort compress_type;
        public ushort edit_time;
        public ushort edit_date;
        public uint crc32;
        public uint compress_size;
        public uint not_compress_size;
        public ushort filename_size;
        public ushort ext_size;
        public ushort commit_size;
        public ushort diskno;
        public ushort file_attr;
        public uint out_file_attr;
        public uint offset;
        public string filename;
        public byte[] ext;
        public string commit;
        public bool is_path() { return crc32 == 0; }
        public bool is_utf8() { return (flag & 0xff00) == 0x0800; }
    }
    internal struct struct_zip_sign
    {
        public ushort size;
        public byte[] sign_data;
    }
    internal struct struct_zip_end
    {
        public ushort diskno;
        public ushort start_diskno;
        public ushort now_central_count;
        public ushort central_count;
        public uint central_size;
        public uint offset;
        public ushort commit_size;
        public string commit;
    }
    internal struct struct_zip_data_desc
    {
        public uint crc32;
        public uint compress_size;
        public uint not_compress_size;
    }
}
